package org.wms.minbearwcs.dao.stock.impl;

import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import org.wms.minbearwcs.dao.stock.inf.MaterialTypeDao;
import org.wms.minbearwcs.entity.Mapper.stock.MaterialTypeMapper;
import org.wms.minbearwcs.entity.PO.wcs.stock.MaterialType;

@Repository
@RequiredArgsConstructor
public class MaterialTypeDaoImpl implements MaterialTypeDao {

    private final MaterialTypeMapper mapper;

    @Override
    public MaterialType selectByMaterialCode(String materialCode) {
        return new LambdaQueryChainWrapper<>(mapper)
                .eq(MaterialType::getMaterialCode,materialCode)
                .last("limit 1")
                .one();
    }
}
